<template>
  <BaseDialog
    :title="(!props.item.orderServiceId ? '新增' : '编辑') + '用户'"
    :handleCancel="handleCancel"
    :dialogVisible="props.dialogVisible"
  >
    <BaseForm
      labelWidth="140px"
      type="rule"
      :handleOk="handleOk"
      :handleCancel="handleCancel"
      :items="formItems"
      v-model:form="ruleForm"
      :rules="rules"
      :refresh="handleSearch"
    >
    </BaseForm>
  </BaseDialog>
</template>

<script setup lang="ts">
import BaseForm from '@/components/base-form.vue'
import BaseDialog from '@/components/base-dialog.vue'
import axios from 'axios'

const props = defineProps({
  dialogVisible: {
    type: Boolean,
  },
  item: {
    type: Object,
  },
  handleSearch: {
    type: Function,
  },
})
const emit = defineEmits(['update:dialogVisible'])

const formItems = ref([
  {
    name: '姓名',
    key: 'planCateId',
    type: 'input',
  },
  {
    name: '登录账号（手机号）',
    key: 'remark',
    type: 'input',
  },
  {
    name: '角色',
    key: 'remark',
    type: 'select',
  },
  {
    name: '状态',
    key: 'isDisable',
    type: 'switch',
    activeValue: 0,
    inactiveValue: 1,
  },
])
const rules = reactive({
  planCateId: [{ required: true, message: '请输入', trigger: 'change' }],
  province: [{ required: true, message: '请选择', trigger: 'change' }],
})
const ruleForm = ref({
  planCateId: '',
  schemeId: '',
  remark: '',
  isDisable: '',
})
const handleOk = (data) => {
  console.log(data)
}
const handleCancel = () => {
  emit('update:dialogVisible', false)
}
</script>

<style lang="scss" scoped></style>
